package oj;

import java.util.Scanner;

public class Day11S {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int a=sc.nextInt();
           int b=0;
           StringBuilder sb=new StringBuilder();
            while (a/2!=0){
               sb.append(a%2);
               a/=2;
            }
            sb.reverse();
            char[] arr=sb.toString().toCharArray();
            int count=0;
            int max=0;
            for (int i = 0; i < arr.length; i++) {
                if(arr[i]==1){
                    count++;
                }else {
                    count=0;
                }
                if(count>max){
                    max=count;
                }
            }
            System.out.println(max);
        }
    }
}
